package com.fw.ui.view.settings.usercontrol.merchantuser;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

import com.fw.service.bean.EntryBean;
import com.fw.service.merchantuser.bean.MerchantUserBean;
import com.fw.ui.bao.MasterDataBAO;
import com.fw.ui.bao.MerchantUserBAO;
import com.fw.ui.bao.MessageBAO;
import com.fw.ui.bao.PropertyBAO;
import com.fw.ui.core.ViewDescription;
import com.fw.ui.util.UICommonUtils;
import com.fw.ui.util.VaadinApplicationObjectSupport;
import com.fw.ui.view.AbstractView;
import com.fw.ui.view.settings.usercontrol.merchantuser.event.DeleteMerchantUserCancelButtonClickListener;
import com.fw.ui.view.settings.usercontrol.merchantuser.event.DeleteMerchantUserDeleteButtonClickListener;
import com.fw.util.StringUtils;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinService;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

@org.springframework.stereotype.Component
@Scope(SCOPE_PROTOTYPE)
@ViewDescription(name = "settings-user-control-merchantuser-delete", path = "/settings/user-control/merchantuser-delete")
public class DeleteMerchantUserView extends AbstractView {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    public static final String DELETE_MERCHANT_USER_MERCHANTUSER_ID_REQUEST_ATTRIBUTE = "DELETE_MERCHANT_USER_MERCHANTUSER_ID_REQUEST_ATTRIBUTE";

    @Autowired
    protected transient VaadinApplicationObjectSupport app;

    @Autowired
    private MerchantUserBAO merchantUserBAO;
    @Autowired
    private MasterDataBAO masterDataBAO;
    @Autowired
    private MessageBAO messageBAO;
    @Autowired
    private PropertyBAO propertyBAO;
    @Autowired
    private UICommonUtils uiCommonUtils;

    /**
     * BEAN
     */
    private MerchantUserBean merchantUserBean = new MerchantUserBean();

    /**
     * EVENT
     */
    @Autowired
    private DeleteMerchantUserCancelButtonClickListener merchantUserCancelButtonClickListener;
    @Autowired
    private DeleteMerchantUserDeleteButtonClickListener merchantUserDeleteButtonClickListener;

    /**
     * COMPONENT
     */
    private Panel deleteMerchantUserPanel = new Panel();

    private Label lblUsername = new Label("", ContentMode.HTML);
    private Label lblName = new Label("", ContentMode.HTML);
    private Label lblEmail = new Label("", ContentMode.HTML);
    private Label lblGroup = new Label("", ContentMode.HTML);
    private Label lblStatus = new Label("", ContentMode.HTML);
    private Label lblExpireDate = new Label("", ContentMode.HTML);
    private Label lblCreateDate = new Label("", ContentMode.HTML);
    private Label lblCreateBy = new Label("", ContentMode.HTML);
    private Label lblLastUpdateDate = new Label("", ContentMode.HTML);
    private Label lblLastUpdateBy = new Label("", ContentMode.HTML);
    private Label lblServiceID = new Label("", ContentMode.HTML);

    private Label lblConfirmDeleteMessage = new Label("", ContentMode.HTML);

    private Button btnDelete = new Button();
    private Button btnCancel = new Button();

    private OptionGroup ogMerchantOrParentId = new OptionGroup();
    private ComboBox cbbMerchant = new ComboBox();
    private ComboBox cbbService = new ComboBox();
    private ComboBox cbbParent = new ComboBox();
    private TextField txtUsername = new TextField();
    private TextField txtName = new TextField();
    private TextField txtEmail = new TextField();
    private ComboBox cbbGroup = new ComboBox();
    private ComboBox cbbStatus = new ComboBox();
    private TextField txtExpireDate = new TextField();
    private TextField txtCreateDate = new TextField();
    private TextField txtCreateBy = new TextField();
    private TextField txtLastUpdateDate = new TextField();
    private TextField txtLastUpdateBy = new TextField();

    private String merchantOption;
    private String parentOption;

    @Override
    public void updateStrings() {

	this.lblUsername.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.username"));
	this.lblEmail.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.email"));
	this.lblName.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.name"));
	this.lblGroup.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.group"));
	this.lblStatus.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.status"));
	this.lblExpireDate.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.expiredate"));
	this.lblCreateDate.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.createdate"));
	this.lblCreateBy.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.createby"));
	this.lblLastUpdateDate.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.lastupdatedate"));
	this.lblLastUpdateBy.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.lastupdateby"));
	this.lblServiceID.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.serviceID"));

	this.lblConfirmDeleteMessage.setValue(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.confirmdelete"));

	this.btnDelete.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.button.delete"));
	this.btnCancel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.button.cancel"));

	this.deleteMerchantUserPanel.setCaption(this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.title"));
    }

    @Override
    public void init() {

	this.merchantOption = this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.merchantID");
	this.parentOption = this.messageBAO
		.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.label.parentID");
	ogMerchantOrParentId.addItem(this.merchantOption);
	ogMerchantOrParentId.addItem(this.parentOption);
	ogMerchantOrParentId.setNullSelectionAllowed(false);
	ogMerchantOrParentId.setValue(this.merchantOption);

	this.setSizeFull();

	this.deleteMerchantUserPanel.setSizeFull();
	this.deleteMerchantUserPanel.setId("deleteMerchantUserPanel");

	this.ogMerchantOrParentId.setWidth("150px");
	this.lblUsername.setWidth("150px");
	this.lblName.setWidth("150px");
	this.lblEmail.setWidth("150px");
	this.lblGroup.setWidth("150px");
	this.lblStatus.setWidth("150px");
	this.lblExpireDate.setWidth("150px");
	this.lblCreateDate.setWidth("150px");
	this.lblCreateBy.setWidth("150px");
	this.lblLastUpdateDate.setWidth("150px");
	this.lblLastUpdateBy.setWidth("150px");
	this.lblServiceID.setWidth("80px");

	this.cbbGroup.setWidth("200px");
	this.cbbStatus.setWidth("200px");
	this.txtUsername.setWidth("200px");
	this.txtEmail.setWidth("200px");
	this.cbbMerchant.setWidth("200px");
	this.cbbService.setWidth("200px");
	this.cbbParent.setWidth("200px");
	this.txtName.setWidth("200px");
	this.txtExpireDate.setWidth("200px");
	this.txtCreateDate.setWidth("200px");
	this.txtCreateBy.setWidth("200px");
	this.txtLastUpdateDate.setWidth("200px");
	this.txtLastUpdateBy.setWidth("200px");

	this.lblConfirmDeleteMessage.addStyleName("label-red");

	this.btnDelete.setId("btnDelete" + UICommonUtils.EXCLUDE_ENABLE_COMPONENT_PREFIX);
	this.btnDelete.addStyleName("button-red");
	this.btnDelete.setDisableOnClick(true);
	this.btnDelete.setWidth("70px");

	this.btnCancel.setId("btnCancel" + UICommonUtils.EXCLUDE_ENABLE_COMPONENT_PREFIX);
	this.btnCancel.addStyleName("button-blue");
	this.btnCancel.setDisableOnClick(true);
	this.btnCancel.setWidth("70px");

	VerticalLayout mainLayout = new VerticalLayout();
	mainLayout.setSizeFull();
	mainLayout.setSizeUndefined();
	mainLayout.setSpacing(true);
	mainLayout.setWidth("100%");

	this.deleteMerchantUserPanel.setContent(mainLayout);

	VerticalLayout formLayout = new VerticalLayout();
	formLayout.setId("formPanel");
	formLayout.setSizeUndefined();
	formLayout.setWidth("100%");
	formLayout.setSpacing(true);

	HorizontalLayout row1 = new HorizontalLayout();
	HorizontalLayout row2 = new HorizontalLayout();
	HorizontalLayout row3 = new HorizontalLayout();
	HorizontalLayout row4 = new HorizontalLayout();
	HorizontalLayout row5 = new HorizontalLayout();
	HorizontalLayout row6 = new HorizontalLayout();
	HorizontalLayout row7 = new HorizontalLayout();
	HorizontalLayout row8 = new HorizontalLayout();
	HorizontalLayout row9 = new HorizontalLayout();
	HorizontalLayout row10 = new HorizontalLayout();
	HorizontalLayout row11 = new HorizontalLayout();
	HorizontalLayout row12 = new HorizontalLayout();
	HorizontalLayout rowButton = new HorizontalLayout();

	row1.setSpacing(true);
	row2.setSpacing(true);
	row3.setSpacing(true);
	row4.setSpacing(true);
	row5.setSpacing(true);
	row6.setSpacing(true);
	row7.setSpacing(true);
	row8.setSpacing(true);
	row9.setSpacing(true);
	row10.setSpacing(true);
	row11.setSpacing(true);
	row12.setSpacing(true);
	rowButton.setSpacing(true);

	row1.setSizeUndefined();
	row2.setSizeUndefined();
	row3.setSizeUndefined();
	row4.setSizeUndefined();
	row5.setSizeUndefined();
	row6.setSizeUndefined();
	row7.setSizeUndefined();
	row8.setSizeUndefined();
	row9.setSizeUndefined();
	row10.setSizeUndefined();
	row11.setSizeUndefined();
	row12.setSizeUndefined();
	rowButton.setSizeUndefined();

	row1.setWidth("600px");
	row2.setWidth("600px");
	row3.setWidth("600px");
	row4.setWidth("600px");
	row5.setWidth("600px");
	row6.setWidth("600px");
	row7.setWidth("600px");
	row8.setWidth("600px");
	row9.setWidth("600px");
	row10.setWidth("600px");
	row11.setWidth("600px");

	VerticalLayout verticalLayout = new VerticalLayout();
	verticalLayout.setSpacing(true);
	verticalLayout.setSizeUndefined();
	HorizontalLayout horizontalLayout = new HorizontalLayout();
	horizontalLayout.setSpacing(true);
	horizontalLayout.setSizeUndefined();
	horizontalLayout.addComponent(cbbMerchant);
	horizontalLayout.addComponent(lblServiceID);
	horizontalLayout.setComponentAlignment(lblServiceID, Alignment.BOTTOM_LEFT);
	horizontalLayout.addComponent(cbbService);
	verticalLayout.addComponent(horizontalLayout);
	verticalLayout.addComponent(cbbParent);
	row1.addComponent(ogMerchantOrParentId);
	row1.addComponent(verticalLayout);
	row1.setComponentAlignment(ogMerchantOrParentId, Alignment.MIDDLE_RIGHT);
	row1.setComponentAlignment(verticalLayout, Alignment.MIDDLE_LEFT);

	row2.addComponent(lblUsername);
	row2.addComponent(txtUsername);
	row2.setComponentAlignment(lblUsername, Alignment.MIDDLE_RIGHT);
	row2.setComponentAlignment(txtUsername, Alignment.MIDDLE_LEFT);

	row3.addComponent(lblEmail);
	row3.addComponent(txtEmail);
	row3.setComponentAlignment(lblEmail, Alignment.MIDDLE_RIGHT);
	row3.setComponentAlignment(txtEmail, Alignment.MIDDLE_LEFT);

	row4.addComponent(lblName);
	row4.addComponent(txtName);
	row4.setComponentAlignment(lblName, Alignment.MIDDLE_RIGHT);
	row4.setComponentAlignment(txtName, Alignment.MIDDLE_LEFT);

	row5.addComponent(lblGroup);
	row5.addComponent(cbbGroup);
	row5.setComponentAlignment(lblGroup, Alignment.MIDDLE_RIGHT);
	row5.setComponentAlignment(cbbGroup, Alignment.MIDDLE_LEFT);

	row6.addComponent(lblStatus);
	row6.addComponent(cbbStatus);
	row6.setComponentAlignment(lblStatus, Alignment.MIDDLE_RIGHT);
	row6.setComponentAlignment(cbbStatus, Alignment.MIDDLE_LEFT);

	row7.addComponent(lblExpireDate);
	row7.addComponent(txtExpireDate);
	row7.setComponentAlignment(lblExpireDate, Alignment.MIDDLE_RIGHT);
	row7.setComponentAlignment(txtExpireDate, Alignment.MIDDLE_LEFT);

	row8.addComponent(lblCreateDate);
	row8.addComponent(txtCreateDate);
	row8.setComponentAlignment(lblCreateDate, Alignment.MIDDLE_RIGHT);
	row8.setComponentAlignment(txtCreateDate, Alignment.MIDDLE_LEFT);

	row9.addComponent(lblCreateBy);
	row9.addComponent(txtCreateBy);
	row9.setComponentAlignment(lblCreateBy, Alignment.MIDDLE_RIGHT);
	row9.setComponentAlignment(txtCreateBy, Alignment.MIDDLE_LEFT);

	row10.addComponent(lblLastUpdateDate);
	row10.addComponent(txtLastUpdateDate);
	row10.setComponentAlignment(lblLastUpdateDate, Alignment.MIDDLE_RIGHT);
	row10.setComponentAlignment(txtLastUpdateDate, Alignment.MIDDLE_LEFT);

	row11.addComponent(lblLastUpdateBy);
	row11.addComponent(txtLastUpdateBy);
	row11.setComponentAlignment(lblLastUpdateBy, Alignment.MIDDLE_RIGHT);
	row11.setComponentAlignment(txtLastUpdateBy, Alignment.MIDDLE_LEFT);

	row12.addComponent(lblConfirmDeleteMessage);
	row12.setComponentAlignment(lblConfirmDeleteMessage, Alignment.MIDDLE_CENTER);

	rowButton.addComponent(btnDelete);
	rowButton.addComponent(btnCancel);

	formLayout.addComponent(new HorizontalLayout());
	formLayout.addComponent(row1);
	formLayout.addComponent(row2);
	formLayout.addComponent(row3);
	formLayout.addComponent(row4);
	formLayout.addComponent(row5);
	formLayout.addComponent(row6);
	formLayout.addComponent(row7);
	formLayout.addComponent(row8);
	formLayout.addComponent(row9);
	formLayout.addComponent(row10);
	formLayout.addComponent(row11);
	formLayout.addComponent(row12);
	formLayout.addComponent(rowButton);
	formLayout.addComponent(new HorizontalLayout());

	formLayout.setComponentAlignment(row1, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row2, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row3, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row4, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row5, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row6, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row7, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row8, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row9, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row10, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row11, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(row12, Alignment.MIDDLE_CENTER);
	formLayout.setComponentAlignment(rowButton, Alignment.MIDDLE_CENTER);

	mainLayout.addComponent(formLayout);
	mainLayout.setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);

	this.addComponent(this.deleteMerchantUserPanel);
	this.setComponentAlignment(this.deleteMerchantUserPanel, Alignment.TOP_CENTER);
    }

    @Override
    public void initListener() {
	this.merchantUserCancelButtonClickListener.setBasedComponent(this);
	this.merchantUserDeleteButtonClickListener.setBasedComponent(this);

	this.merchantUserCancelButtonClickListener.setAutoEnabled(true);
	this.merchantUserDeleteButtonClickListener.setAutoEnabled(true);

	this.btnCancel.addClickListener(this.merchantUserCancelButtonClickListener);
	this.btnDelete.addClickListener(this.merchantUserDeleteButtonClickListener);
    }

    @Override
    public void initValidator() {

    }

    @Override
    public void initData() {
	try {
	    Long merchantUserId = (Long) VaadinService.getCurrentRequest().getAttribute(
		    DELETE_MERCHANT_USER_MERCHANTUSER_ID_REQUEST_ATTRIBUTE);
	    if (merchantUserId == null) {
		String landing = propertyBAO.getPropertyValue("view.settings-user-control-merchantuser-search.path");
		this.getUI().getNavigator().navigateTo(landing);
	    } else {
		MerchantUserBean merchantUserBean = merchantUserBAO.getMerchantUser(merchantUserId);
		if (merchantUserBean == null) {
		    String msg = this.messageBAO.getMessage("message.error.common");
		    Notification notification = new Notification("Warning", msg, Notification.Type.WARNING_MESSAGE, true);
		    notification.setDelayMsec(1000);
		    notification.show(Page.getCurrent());
		} else {
		    this.setMerchantUserBean(merchantUserBean);

		    DateFormat dateFormat = new SimpleDateFormat(StringUtils.PATTERN_DATE_PERSISTENCE);
		    DateFormat dateTimeFormat = new SimpleDateFormat(StringUtils.PATTERN_DATETIME_PERSISTENCE);
		    DateFormat dateFormatUI = new SimpleDateFormat(StringUtils.PATTERN_DATE_UI);
		    DateFormat dateTimeFormatUI = new SimpleDateFormat(StringUtils.PATTERN_DATETIME_UI);

		    if (merchantUserBean.getMerchantID() != null) {
			this.ogMerchantOrParentId.setValue(this.getMerchantOption());
			List<EntryBean<Long, String>> merchantProfiles = masterDataBAO.selectAllMerchantUserMerchantProfile();
			if (merchantProfiles != null) {
			    for (EntryBean<Long, String> entry : merchantProfiles) {
				this.cbbMerchant.addItem(entry.getValue());
				this.cbbMerchant.setItemCaption(entry.getValue(), entry.getValue());
			    }
			}
			this.cbbMerchant.setValue(merchantUserBean.getMerchantID());

			List<EntryBean<Long, String>> serviceProfiles = masterDataBAO.selectAllMerchantUserServiceProfile(merchantUserBean
				.getMerchantID());
			if (serviceProfiles != null) {
			    for (EntryBean<Long, String> entry : serviceProfiles) {
				this.cbbService.addItem(entry.getValue());
				this.cbbService.setItemCaption(entry.getValue(), entry.getValue());
			    }
			}
			this.cbbService.setValue(merchantUserBean.getServiceID());
		    }
		    if (merchantUserBean.getParentID() != null) {
			this.ogMerchantOrParentId.setValue(this.getParentOption());
			List<EntryBean<Long, String>> parentMerchants = masterDataBAO.selectAllMerchantUserParentMerchant();
			if (parentMerchants != null) {
			    for (EntryBean<Long, String> entry : parentMerchants) {
				this.cbbParent.addItem(entry.getValue());
				this.cbbParent.setItemCaption(entry.getValue(), entry.getValue());
			    }
			}
			this.cbbParent.setValue(merchantUserBean.getParentID());
		    }

		    this.txtUsername.setValue(merchantUserBean.getUsername());
		    this.txtEmail.setValue(merchantUserBean.getEmail());
		    this.txtName.setValue(merchantUserBean.getName());

		    List<EntryBean<Long, String>> roles = masterDataBAO.selectAllMerchantUserRole();
		    if (roles != null) {
			for (EntryBean<Long, String> entry : roles) {
			    this.cbbGroup.addItem(entry.getValue());
			    this.cbbGroup.setItemCaption(entry.getValue(), entry.getValue());
			}
		    }

		    List<EntryBean<String, String>> statuses = masterDataBAO.selectMerchantUserStatusByCurrentStatus(merchantUserBean
			    .getStatus());
		    if (statuses != null) {
			for (EntryBean<String, String> entry : statuses) {
			    this.cbbStatus.addItem(entry.getKey());
			    this.cbbStatus.setItemCaption(entry.getKey(), entry.getValue());
			}
		    }

		    this.cbbGroup.setValue(merchantUserBean.getRole());
		    this.cbbStatus.setValue(merchantUserBean.getStatus());

		    if (merchantUserBean.getExpiredDate() != null) {
			try {
			    Date date = dateFormat.parse(merchantUserBean.getExpiredDate());
			    String strUI = dateFormatUI.format(date);
			    this.txtExpireDate.setValue(strUI);
			} catch (Exception e) {
			}
		    }
		    if (merchantUserBean.getCreateDatetime() != null) {
			try {
			    Date date = dateTimeFormat.parse(merchantUserBean.getCreateDatetime());
			    String strUI = dateTimeFormatUI.format(date);
			    this.txtCreateDate.setValue(strUI);
			} catch (ParseException e) {
			}
		    }
		    if (merchantUserBean.getLastUpdateDatetime() != null) {
			try {
			    Date date = dateTimeFormat.parse(merchantUserBean.getLastUpdateDatetime());
			    String strUI = dateTimeFormatUI.format(date);
			    this.txtLastUpdateDate.setValue(strUI);
			} catch (ParseException e) {
			}
		    }

		    this.txtCreateBy.setValue(merchantUserBean.getCreateBy());
		    this.txtLastUpdateBy.setValue(merchantUserBean.getLastUpdateBy());

		    String activeStatus = propertyBAO
			    .getPropertyValue("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.exclude.status.item.active");
		    if (!activeStatus.equals(merchantUserBean.getStatus())) {
			this.btnDelete.setEnabled(false);
			this.lblConfirmDeleteMessage.setValue("");
			this.btnCancel.setCaption(this.messageBAO
				.getMessage("com.fw.ui.view.settings.usercontrol.merchantuser.DeleteMerchantUserView.button.close"));
		    }
		}
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	    String msg = this.messageBAO.getMessage("message.error.common");
	    Notification notification = new Notification("Warning", msg, Notification.Type.WARNING_MESSAGE, true);
	    notification.setDelayMsec(1000);
	    notification.show(Page.getCurrent());
	}

	uiCommonUtils.setEnableAllUIComponent(this, false);
    }

    public MerchantUserBean getMerchantUserBean() {
	return merchantUserBean;
    }

    public void setMerchantUserBean(MerchantUserBean merchantUserBean) {
	this.merchantUserBean = merchantUserBean;
    }

    public Button getBtnDelete() {
	return btnDelete;
    }

    public ComboBox getCbbStatus() {
	return cbbStatus;
    }

    public TextField getTxtLastUpdateDate() {
	return txtLastUpdateDate;
    }

    public TextField getTxtLastUpdateBy() {
	return txtLastUpdateBy;
    }

    public Label getLblConfirmDeleteMessage() {
	return lblConfirmDeleteMessage;
    }

    public Button getBtnCancel() {
	return btnCancel;
    }

    public String getMerchantOption() {
	return merchantOption;
    }

    public String getParentOption() {
	return parentOption;
    }
}
